<template>
  <div class="app-bg auto">
    <div class="auto" style="background:#108ADD;text-align:center; padding:10px 0px;color:#FFF;font-size: 18px;">
      博能燃气手机抄表
    </div>
    <div class="atuo" style="padding: 10px;">
        <span>表册号：{{rowdata.f_meterbook_id}}</span>
    </div>
      <div class="row app-input">
        <label class="col-xs-4 control-label text-left">户号</label>
        <input class="col-xs-8" v-model="model.f_userinfo_id" placeholder="请输入用户编号">
      </div>
      <div class="row app-input">
        <label class="col-xs-4 control-label text-left">姓名</label>
        <input class="col-xs-8" v-model="model.f_user_name" placeholder="请输入用户姓名">
      </div>
      <div class="row app-input">
        <label class="col-xs-4 control-label text-left">用户地址</label>
        <input class="col-xs-8" v-model="model.f_address" placeholder="请输入用户地址">
      </div>
      <div class="row app-input">
        <label class="col-xs-4 control-label text-left">抄表状态</label>
        <input class="col-xs-8" v-model="model.f_meter_state" placeholder="请输入抄表状态">
      </div>
      <div class="row app-btn" style="margin-bottom: -5px;">
        <button class="btn btn-primary col-xs-6" @click= "planinfomation()"><span class="glyphicon glyphicon-zoom-in" style="margin-right: 20px;"></span>查询</button>
        <!-- @click="upload(false)" -->
        <button class="btn btn-primary col-xs-6"  @click= "this.$goto('home-page')"><span class="glyphicon glyphicon-zoom-in" style="margin-right: 20px;"></span>返回首页</button>
      </div>
    <div v-for='row in user' class="app-list">
      <div class="row" style="color: #00B9F1;">
        <span class="col-xs-3">户号：</span><span class="col-xs-3">{{row.f_userinfo_id}}</span>
        <!-- <span class="col-xs-3">上传状态：</span><span class="col-xs-3" @click="upload(row)">{{row.f_upload}}</span> -->
      </div>
      <div class="row">
        <span class="col-xs-3">姓名：</span><span class="col-xs-3">{{row.f_user_name}}</span>
        <span class="col-xs-3">状态：</span><span class="col-xs-3">{{row.f_meter_state}}</span>
      </div>
      <div class="row">
        <span class="col-xs-3">上指数：</span><span class="col-xs-3">{{row.f_last_tablebase}}</span>
        <span class="col-xs-3">本指数：</span><span class="col-xs-3">{{row.f_tablebase}}</span>
      </div>
      <div class="row">
        <span class="col-xs-3">表位置：</span><span class="col-xs-3">{{row.f_position}}</span>
        <span class="col-xs-3">表口径：</span><span class="col-xs-3">{{row.f_meter_bore}}</span>
      </div>
      <div class="row">
        <span class="col-xs-3">地址：</span><span class="col-xs-8">{{row.f_address}}</span>
      </div>
      <div class="row">
        <span class="col-xs-3">用水量：</span><span class="col-xs-3">{{row.f_oughtamount}}</span>
        <span class="col-xs-3 col-xs-offset-3"  @click="handplan(row)"><button class="btn btn-link">——></button></span>
      </div>
    </div>
  </div>
</template>

<script>
import co from 'co'
import config from '../../../src/components/config'
import appData from '../../../src/components/appData'
import * as Util from '../Util'
export default {
  props: ['rowdata'],
  title:'抄表用户信息',
  data () {
    return {
      model: {
        f_user_name:'',
        f_userinfo_id:'',
        f_upload: '',
        f_meter_state:'未抄表',
        f_address:''
      },
      //拿到的抄表计划
      user: [],
      //拿到的已抄表未上传数据
      handplandata: []
    }
  },
  methods: {
    //根据条件拿到下载的计划
    planinfomation () {
      let condition = '1=1 and h.f_meterbook_id=' + `'${this.rowdata.f_meterbook_id}' and h.f_inputtor= `  + `'${appData.loginUser.logininfo[0].f_bieming}'`
      for (var key in this.model) {
        if (this.model[key] !== '' ) {
          condition  = condition + ` and h.${key} like '%${this.model[key]}%'`
        }
      }
      this.$resetpost(config.resultUrl + 'rs/sql/linshi', {data:{condition: condition}},{resolveMsg: null, rejectMsg: null})
      // this.$post('rs/sql/linshi', {data:{condition: condition}},{resolveMsg: null, rejectMsg: null})
      .then((res)=>{
        console.log('nadao de shuju '+ res.data);
        this.user = res.data
      })
    },
    //缴费或者抄表
    handplan(row){
      if (row.f_meter_state === "已抄表" && row.f_tablebase !== '') {
        this.$goto('owe-info',{userinfo:row,flag: true},'self',this.call)
      } else {
        this.$goto('meter-missionlist', {row:row,userfiles:this.user}, 'self', this.call)
      }
    },
    call () {
      this.planinfomation()
    }

  },
  ready () {
    this.planinfomation()
  }
}
</script>
